package today.rocky.boot.controller;

import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @vlog:
 * @description:
 * @author: Rocky
 * @createDate: 2020/7/4 19:57
 */
@RestController
public class SendController {
	@Autowired
	private RocketMQTemplate rocketMQTemplate;

	@GetMapping("/send")
	public String send(String msg){
		for (int i = 0; i < 2; i++) {
			rocketMQTemplate.convertAndSend("test-topic-1", msg+i);
		}
		return "success";
	}

}
